/*
 * 使用示例:
 * app.use(serve(options));
 * 
 * options支持的参数格式:
 * 1: path.resolve(__dirname, './static1')
 * 2: [path.resolve(__dirname, './static1'), path.resolve(__dirname, './static2')]
 */
'use strict';

const serve = require('koa-static');
const compose = require('koa-compose');

exports = module.exports = (options) => {
  if (Array.isArray(options)) {
    let result = [];
    options.map(c => result.push(serve(c)));
    return compose(result);
  } else {
    return serve(options);
  }
};